﻿#if !LITE
using System;
using System.Collections.Generic;
using System.Text;

using Elegant.Ui;

namespace iPdf
{
    class OfficePage: ConvertPage<OfficeToPdfOption>
    {
        private bool IsPdfA
        {
            get
            {
                return this.FormatGallery.SelectedFormat == PdfCreatorFormat.PDF_A;
            }
        }

        public override FileFormat SourceFormat
        {
            get
            {
                return FileFormat.OfficeFormats;
            }
        }

        public override FileFormat[] SourceFormats
        {
            get
            {
                return new FileFormat[]{ FileFormat.OfficeFormats, FileFormat.WordFormat, 
                                                        FileFormat.ExcelFormat, FileFormat.PowerPointFormat};
            }
        }

        public override string IntroInfo
        {
            get
            {
                return global::iPdf.Properties.Resources.OfficePageIntroInfo;
            }
        }

        public override PdfLetOption PdfLets
        {
            get
            {
                return new PdfLetOption(true, !IsPdfA, true);
            }
        }

        protected override OfficeToPdfOption PageOption
        {
            get
            {
                OfficeToPdfOption option = new OfficeToPdfOption();
                option.Bookmark = Global.MainWindow.PdfLets.Bookmark;
                option.Hyperlink = Global.MainWindow.PdfLets.Hyperlink && !IsPdfA;
                option.Navigator = Global.MainWindow.PdfLets.Navigator;

                option.Format = FormatGallery.SelectedFormat;
                return option;
            }
        }

        public OfficePage()
            :base(true)
        {
            actor = new OfficeToPdfConverter();
        }

        protected override void InstallEventHandlers()
        {
            base.InstallEventHandlers();

            FormatGallery.SelectedItemChanged += new EventHandler<GallerySelectedItemChangedEventArgs>(
                delegate(object sender, GallerySelectedItemChangedEventArgs e)
                {
                    Global.MainWindow.UpdateOptionGroup();
                });
        }

    }
}
#endif